home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / satellit / im2gif / header.c < prev    next >
Text File  |  1991-11-24  |  1KB  |  78 lines

  1. /* Display IMnnnn file header.
  2.  
  3. NK6K
  4. */
  5.  
  6.  
  7. struct HEADER {
  8.     long start;
  9.     long end;
  10.     long image;
  11.     long retry;
  12.     long set;
  13.     char integration;
  14.     char gain;
  15. }header;
  16.  
  17. #include <stdio.h>
  18. #include <dos.h>
  19. #include <fcntl.h>
  20. #include <sys\types.h>
  21. #include <sys\stat.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <time.h>
  25.  
  26.  
  27. char buff[256];
  28. char s1[256];
  29.  
  30. main(argc,argv)
  31. int argc;
  32. char *argv[];
  33. {
  34.  
  35.     int fi1,fi2,fo;
  36.     int i;
  37.  
  38.     if (argc<2) {
  39.         printf ("usage: header <im_file> \n");
  40.         exit(1);
  41.     }
  42.  
  43.  
  44.     if ((fi1= open(argv[1], O_BINARY)) == -1){
  45.         printf("cannot open: %s\n",argv[1]);
  46.         perror("On input file");
  47.         exit(1);
  48.     }
  49.  
  50.     if (read(fi1, &header, sizeof(header))==-1) {
  51.             perror("On input file header\n");
  52.             exit(1);
  53.     }
  54.  
  55.     sprintf(s1, "%s", asctime(gmtime(&header.start))+4);
  56.     s1[strlen(s1)-5] = '\0';
  57.     printf("sequence start:  %15.15s  \n", s1);
  58.  
  59.     sprintf(s1, "%s", asctime(gmtime(&header.end))+4);
  60.     s1[strlen(s1)-5] = '\0';
  61.     printf("image start   :  %15.15s  \n", s1);
  62.  
  63.     printf("Image number  : %lu\n",header.image);
  64.     printf("Retries       : %lu\n",header.retry);
  65.     printf("Integration   : %u\n",header.integration);
  66.     printf("Gain          : %u\n",header.gain);
  67.  
  68.  
  69.  
  70.  
  71.     close (fi1);
  72.  
  73. }
  74.  
  75.  
  76.  
  77.  
  78.